var SysTplPconfigListObj= {
    showSysTplPconfigList:function(tableId, postUrl) {
        Tools.page({
            "tableId": tableId,
            "postUrl": postUrl,
            "bFilter": false,
            "iDisplayLength": 10,
            "aoColumns": [
                {"mDataProp": "id"},
                {"mDataProp": "confkey"},
                {"mDataProp": "confvalue"},
                {"mDataProp": "description"},
                {"mDataProp": function (obj) {
                    return "<button type=\"button\" data-id='"+obj.id+"' onclick='SysTplPconfigListObj.deleteSysTplPconfigById("+obj.id+")'" +
                        "class=\"btn btn-primary\" >删除</button>";
                }}
            ],
            "aaSorting": [[2, "desc"]], //默认排序
            "aoColumnDefs": [//和aoColums类似，但他可以给指定列附近爱属性
                {"bSortable": true, "aTargets": [1]},  //这句话意思是第1,3,6,7,8,9列（从0开始算） 不能排序
                {"bSearchable": true, "aTargets": [1, 2]}, //bSearchable 这个属性表示是否可以全局搜索，其实在服务器端分页中是没用的
            ]
        });
    },
    deleteSysTplPconfigById:function(id){
        swal({
            title: "您确定要删除这条信息吗",
            text: "删除后将无法恢复，请谨慎操作！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            closeOnConfirm: false
        }, function () {
            $.post("/sysTplPconfig/delete.do/"+id,{},function(result){
                if(result.success){
                    swal({
                        title: "删除成功！",
                        text: "您已经永久删除了这条信息。",
                        type: "success"
                    },function(){
                        window.location.href='/sysTplPconfig/sysTplPconfigList.show';
                    });

                }else{
                    swal("删除失败！", "删除了这条信息失败。", "error");
                }
            });
        });
    },
    updatePconfigById:function(){
        swal({
            title: "您将更新这条信息",
            text: "",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            closeOnConfirm: false
        }, function () {
            var data=utils.getFormData("updateSysTplPconfigForm");
            console.log(data);
            $.post("/sysTplPconfig/update.do",data,function(result){
                if(result.success){
                    swal({
                        title: "更新成功！",
                        text: "",
                        type: "success"
                    },function(){
                        window.location.href='/sysTplPconfig/sysTplPconfigList.show';
                    });

                }else{
                    swal("更新失败！", "", "error");
                }
            });
        });
    },
    myModalTPLShow:function(id,obj){
        var $thisTDK = $(obj).parents("tr").find("td");
        $("#confkey").empty().val($thisTDK[2].innerHTML);
        $("#confvalue").empty().val($thisTDK[3].innerHTML);
        $("#description").empty().val($thisTDK[4].innerHTML);
        $("#temp_id").empty().val(id);
    }
}